extends "../i_horse/i_horse.gd"

func init():
	.init()
	name = "纯血宝马"
	info = "纯血守护：为自身上下1格队友附加（自身生命上限*5%+双防和*0.5的护盾）并对自身前方1格敌人附加2层<虚弱>和<反噬>[cd:7秒]\n" + info
	resetdata()

func _connect():
	._connect()
	
#技能计时
func _upS():
	._upS()
	cnt2 += 1
	if cnt2 == 7:
		cnt2 = 0
		cxlz(masCha)
#纯血良种
func cxlz(cha):
	var v = [Vector2(0,-1),Vector2(0,1)]
	var c = cha.cell
	for i in v:
		var tmp = sys.main.matCha(c + i)
		if tmp && tmp.team == cha.team:
			if tmp.has_method("changShield"):
				tmp.changeShield(cha.att.maxHp * 0.05 + (cha.att.def + cha.att.mgiDef) * 0.5 )
	var k
	if cha.team == 2:
		k = Vector2(-1,0)
	else:
		k = Vector2(1,0)
	if cha.aiCha.cell.x > cha.cell.x:
		k = Vector2(1,0)
	if cha.aiCha.cell.x < cha.cell.x:
		k = Vector2(-1,0)
	var tmp = sys.main.matCha(k + c)
	if tmp && tmp.team != cha.team:
		tmp.addBuff(ctrl.b_xr.new(2))
		tmp.addBuff(ctrl.b_fs.new(2))